//开始上传
function uploadFile(i) {
    var mchid = null;
    if (i == 0) {
        mchid = $("#mchid").val();
    } else {
        mchid = $("#editmchid").val();
    }
    if (mchid == '' || mchid == undefined || mchid == null) {
        alert("商户号不能为空");
    } else {
        var formData = new FormData();
        if (i == 0) {
            formData.append("files", $("#upload-file")[0].files[0]);
        } else {
            formData.append("files", $("#editupload-file")[0].files[0]);
        }
        formData.append("mchid", mchid);
        console.log($("#mchid").val());
        $.ajax({
            type: 'POST',
            url: CONTEXT_PATH + "/pos/shang",
            data: formData,
            contentType: false,
            processData: false,//这个很有必要，不然不行
            dataType: "json",
            mimeType: "multipart/form-data",
            success: function (data) {
                alert(data);
            }, error: function (data) {
                alert(data);
            }
        });
    }
}


//开始上传
function abcuploadFile(i) {
    var mchid = null;
    if (i == 0) {
        mchid = $("#abcmerchantID").val();
    } else {
        mchid = $("#editabcmerchantID").val();
    }
    if (mchid == '' || mchid == undefined || mchid == null) {
        alert("商户号不能为空");
    } else {
        var formData = new FormData();
        if (i == 0) {
            formData.append("files", $("#upload-file")[0].files[0]);
        } else {
            formData.append("files", $("#editupload-file")[0].files[0]);
        }
        formData.append("mchid", mchid);
        console.log($("#abcmerchantID").val());
        $.ajax({
            type: 'POST',
            url: CONTEXT_PATH + "/pos/abcpr",
            data: formData,
            contentType: false,
            processData: false,//这个很有必要，不然不行
            dataType: "json",
            mimeType: "multipart/form-data",
            success: function (data) {
                alert(data);
            }, error: function (data) {
                alert(data);
            }
        });
    }
}

//开始上传
function laKaLaUploadFile(i) {
    var appid = null;
    if (i == 0) {
        appid = $("#laKaLaAppid").val();
    } else {
        appid = $("#editlaKaLaAppid").val();
    }
    if (appid == '' || appid == undefined || appid == null) {
        alert("appid不能为空");
    } else {
        var formData = new FormData();
        if (i == 0) {
            formData.append("files", $("#laKaLaUploadFile")[0].files[0]);
        } else {
            formData.append("files", $("#editlaKaLaUploadFile")[0].files[0]);
        }
        formData.append("appid", appid);
        console.log($("#appid").val());
        $.ajax({
            type: 'POST',
            url: CONTEXT_PATH + "/pos/lakalapr",
            data: formData,
            contentType: false,
            processData: false,//这个很有必要，不然不行
            dataType: "json",
            mimeType: "multipart/form-data",
            success: function (data) {
                alert(data);
            }, error: function (data) {
                alert(data);
            }
        });
    }
}

function laKaLaUploadFilePu(i) {
    var appid = null;
    if (i == 0) {
        appid = $("#laKaLaAppid").val();
    } else {
        appid = $("#editlaKaLaAppid").val();
    }
    if (appid == '' || appid == undefined || appid == null) {
        alert("appid不能为空");
    } else {
        var formData = new FormData();
        if (i == 0) {
            formData.append("files", $("#laKaLaUploadFilePu")[0].files[0]);
        } else {
            formData.append("files", $("#editlaKaLaUploadFilePu")[0].files[0]);
        }
        formData.append("appid", appid);
        console.log($("#appid").val());
        $.ajax({
            type: 'POST',
            url: CONTEXT_PATH + "/pos/lakalapu",
            data: formData,
            contentType: false,
            processData: false,//这个很有必要，不然不行
            dataType: "json",
            mimeType: "multipart/form-data",
            success: function (data) {
                alert(data);
            }, error: function (data) {
                alert(data);
            }
        });
    }
}


//微信
//是不需要子商户，隐藏子商户
function wxIsbuZiShangHu() {
    //隐藏微信的字商户
    $("#wxZiAppID").hide();
    $("#WXChildAppID").removeAttr("name");
    $("#WXChildAppID").removeAttr("required");
}

function wxIsZiShangHu() {
    //显示微信的字商户 WXChildAppID
    $("#wxZiAppID").show();
    $("#WXChildAppID").attr("name", "payCompanyInfos[" + $("#wxIsCallback").val() + "].wxPayJsonVo.childMerchants");
    $("#WXChildAppID").attr("required", "");
}

//给微信赋值
function weixin(i) {
    $("#appID").attr("name", "payCompanyInfos[" + i + "].wxPayJsonVo.appID");
    $("#mchid").attr("name", "payCompanyInfos[" + i + "].wxPayJsonVo.mchid");
    $("#key").attr("name", "payCompanyInfos[" + i + "].wxPayJsonVo.key");
    $("#AppSecret").attr("name", "payCompanyInfos[" + i + "].wxPayJsonVo.appSecret");
    $("#payType").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#remark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#paytype1").attr("data-placeholder", "请从列表选择一项");
    $("#paytype1").attr("required", "");
    $("#appID").attr("required", "");
    $("#mchid").attr("required", "");
    $("#key").attr("required", "");

    //判断是否需要子商户
    $("#wxIsCallback").val(i);
    var val = $('input:radio[name="wxIsEvery"]:checked').val();
    if (val == "1") {
        wxIsZiShangHu();
    }
}

$("#paytype1").change(function () {
    var reslist = $("#paytype1").select2("data");
    var payTypeString = payTypes(reslist);
    WXcallback(payTypeString);
    $("#payType").val(payTypeString);
});

//判断是否需要回调地址
function WXcallback(payTypeString) {
    if (payTypeString.substr(0, 1) == "1" || payTypeString.substr(2, 1) == "1"
        || payTypeString.substr(3, 1) == "1") {
        $("#wxCallbacks").show();
        $("#WXCallback").attr("name", "payCompanyInfos[" + $("#wxIsCallback").val() + "].wxPayJsonVo.callbackAddress");
        $("#WXCallback").attr("required", "");
    } else {
        $("#wxCallbacks").hide();
        $("#WXCallback").removeAttr("name");
        $("#WXCallback").removeAttr("required");
    }
}

function alicallback(payTypeString) {
    if (payTypeString.substr(0, 1) == "1" || payTypeString.substr(2, 1) == "1"
        || payTypeString.substr(3, 1) == "1") {
        $("#aliCallbacks").show();
        $("#aliCallback").attr("name", "payCompanyInfos[" + $("#aliIsCallback").val() + "].zfbPayJsonVo.callbackAddress");
        $("#aliCallback").attr("required", "");
    } else {
        $("#aliCallbacks").hide();
        $("#aliCallback").removeAttr("name");
        $("#aliCallback").removeAttr("required");
    }
}

$("#zpaytype").change(function () {
    var reslist = $("#zpaytype").select2("data");
    var payTypeString = payTypes(reslist);
    alicallback(payTypeString);
    $("#payType2").val(payTypeString);
});

$("#icbcPayTypeselect").change(function () {
    var reslist = $("#icbcPayTypeselect").select2("data");
    $("#icbcPayType").val(payTypes(reslist));
});

$("#unionpaytype").change(function () {
    var reslist = $("#unionpaytype").select2("data");
    var payTypeString = payTypes(reslist);
    unionCallback(payTypeString);
    $("#payType3").val(payTypeString);
});

//判断是否需要回调地址
function unionCallback(payTypeString) {
    if (payTypeString.substr(0, 1) == "1" || payTypeString.substr(2, 1) == "1"
        || payTypeString.substr(3, 1) == "1") {
        $("#unionCallbacks").show();
        $("#unionCallback").attr("name", "payCompanyInfos[" + $("#unionIsCallback").val() + "].unionJsonPayVo.callbackAddress");
        $("#unionCallback").attr("required", "");
    } else {
        $("#unionCallbacks").hide();
        $("#unionCallback").removeAttr("name");
        $("#unionCallback").removeAttr("required");
    }
}

$("#qingDaoNongShangtype").change(function () {
    var reslist = $("#qingDaoNongShangtype").select2("data");
    $("#payType4").val(payTypes(reslist));
});

$("#ShouQianBaPayType").change(function () {
    var reslist = $("#ShouQianBaPayType").select2("data");
    $("#ShouQianBaPayTypes").val(payTypes(reslist));
});
$("#ccbbPayType").change(function () {
    var reslist = $("#ccbbPayType").select2("data");
    var payTypeString = payTypes(reslist);
    $("#ccbbPayTypes").val(payTypeString);
    ccbbcallbackg(payTypeString);
});

//判断是否需要回调地址
function ccbbcallbackg(payTypeString) {
    if (payTypeString.substr(0, 1) == "1" || payTypeString.substr(2, 1) == "1"
        || payTypeString.substr(3, 1) == "1") {
        $("#ccbbCallbacks").show();
        $("#ccbbCallback").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.callbackAddress");
        $("#ccbbCallback").attr("required", "");
        $("#ccbbAPPID").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.wxappid");
        $("#ccbbAPPID").attr("required", "");
    } else {
        $("#ccbbCallbacks").hide();
        $("#ccbbCallback").removeAttr("name");
        $("#ccbbCallback").removeAttr("required");
        $("#ccbbAPPID").removeAttr("name");
        $("#ccbbAPPID").removeAttr("required");
    }
}

$("#kancloudType").change(function () {
    var reslist = $("#kancloudType").select2("data");
    $("#kancloudTypes").val(payTypes(reslist));
});
$("#leshuaType").change(function () {
    var reslist = $("#leshuaType").select2("data");
    $("#leshuaTypes").val(payTypes(reslist));
});
$("#chinaumsType").change(function () {
    var reslist = $("#chinaumsType").select2("data");
    var payTypeString = payTypes(reslist);
    chinaumsCallback(payTypeString);
    $("#chinaumsTypes").val(payTypeString);
});

//判断是否需要回调地址
function chinaumsCallback(payTypeString) {
    if (payTypeString.substr(0, 1) == "1" || payTypeString.substr(2, 1) == "1"
        || payTypeString.substr(3, 1) == "1") {
        $("#chinaumsCallbacks").show();
        $("#chinaumsCallback").attr("name", "payCompanyInfos[" + $("#chinaumsIsCallback").val() + "].chinaums.callbackAddress");
        $("#chinaumsCallback").attr("required", "");
    } else {
        $("#chinaumsCallbacks").hide();
        $("#chinaumsCallback").removeAttr("name");
        $("#chinaumsCallback").removeAttr("required");
    }
}

$("#unionschoolType").change(function () {
    var reslist = $("#unionschoolType").select2("data");
    var payTypeString = payTypes(reslist);
    unionschoolCallback(payTypeString);
    $("#unionschoolTypes").val(payTypeString);
});

//判断是否需要回调地址
function unionschoolCallback(payTypeString) {
    if (payTypeString.substr(0, 1) == "1" || payTypeString.substr(2, 1) == "1"
        || payTypeString.substr(3, 1) == "1") {
        $("#unionschoolCallbacks").show();
        $("#unionschoolCallback").attr("name", "payCompanyInfos[" + $("#unionschoolIsCallback").val() + "].unionSchool.callbackAddress");
        $("#unionschoolCallback").attr("required", "");
    } else {
        $("#unionschoolCallbacks").hide();
        $("#unionschoolCallback").removeAttr("name");
        $("#unionschoolCallback").removeAttr("required");
    }
}

$("#FuHuiBaType").change(function () {
    var reslist = $("#FuHuiBaType").select2("data");
    $("#FuHuiBaTypes").val(payTypes(reslist));
});
$("#ksrcbType").change(function () {
    var reslist = $("#ksrcbType").select2("data");
    $("#ksrcbTypes").val(payTypes(reslist));
});
$("#SuiXingPaytype").change(function () {
    var reslist = $("#SuiXingPaytype").select2("data");
    var payTypeString = payTypes(reslist);
    SuiXingPayCallback(payTypeString);
    $("#SuiXingPaytypes").val(payTypeString);
});

//判断是否需要回调地址
function SuiXingPayCallback(payTypeString) {
    if (payTypeString.substr(0, 1) == "1" || payTypeString.substr(2, 1) == "1"
        || payTypeString.substr(3, 1) == "1") {
        $("#SuiXingPayCallbacks").show();
        $("#SuiXingPayCallback").attr("name", "payCompanyInfos[" + $("#SuiXingPayIsCallback").val() + "].suiXingPay.callbackAddress");
        $("#SuiXingPayCallback").attr("required", "");
    } else {
        $("#SuiXingPayCallbacks").hide();
        $("#SuiXingPayCallback").removeAttr("name");
        $("#SuiXingPayCallback").removeAttr("required");
    }
}

$("#abcbType").change(function () {
    var reslist = $("#abcbType").select2("data");
    $("#abcTypes").val(payTypes(reslist));
});

$("#qsftype").change(function () {
    var reslist = $("#qsftype").select2("data");
    var payTypeString = payTypes(reslist);
    $("#qsftypes").val(payTypeString);
});

//隐藏支付渠道
function ispayvisible(i) {
    if (i == 1) {
        $("#payChannel").removeAttr("name");
        $("#ZFQD").hide()
        $("#type").removeAttr("data-placeholder");
        $("#type").removeAttr("required");
        yin();
    } else {
        $("#payChannel").attr("name", "payChannel");
        $("#type").attr("data-placeholder", "请从列表选择一项");
        $("#type").attr("required", "");
        $("#ZFQD").show()
    }
}

$("#ShengCantype").change(function () {
    var reslist = $("#ShengCantype").select2("data");
    $("#ShengCantypes").val(payTypes(reslist));
});
$("#POSTongtype").change(function () {
    var reslist = $("#POSTongtype").select2("data");
    $("#POSTongtypes").val(payTypes(reslist));
});
$("#huiYinTongType").change(function () {
    var reslist = $("#huiYinTongType").select2("data");
    $("#huiYinTongTypes").val(payTypes(reslist));
});


$("#bocomType").change(function () {
    var reslist = $("#bocomType").select2("data");
    var payTypeString = payTypes(reslist);
    bocomCallback(payTypeString);
    $("#bocomTypes").val(payTypeString);
});

//判断是否需要回调地址
function bocomCallback(payTypeString) {
    if (payTypeString.substr(0, 1) == "1" || payTypeString.substr(2, 1) == "1"
        || payTypeString.substr(3, 1) == "1") {
        $("#bocomCallbacks").show();
        $("#bocomCallback").attr("name", "payCompanyInfos[" + $("#bocomIsCallback").val() + "].bocom.callbackAddress");
        $("#bocomCallback").attr("required", "");
    } else {
        $("#bocomCallbacks").hide();
        $("#bocomCallback").removeAttr("name");
        $("#bocomCallback").removeAttr("required");
    }
}

$("#SandHippoType").change(function () {
    var reslist = $("#SandHippoType").select2("data");
    $("#SandHippoTypes").val(payTypes(reslist));
});

$("#laKaLaType").change(function () {
    var reslist = $("#laKaLaType").select2("data");
    var payTypeString = payTypes(reslist);
    laKaLaCallback(payTypeString);
    $("#laKaLaTypes").val(payTypeString);
});

//判断是否需要回调地址
function laKaLaCallback(payTypeString) {
    if (payTypeString.substr(0, 1) == "1" || payTypeString.substr(2, 1) == "1"
        || payTypeString.substr(3, 1) == "1") {
        $("#laKaLaCallbacks").show();
        $("#laKaLaCallback").attr("name", "payCompanyInfos[" + $("#laKaLaIsCallback").val() + "].laKaLaVo.callbackAddress");
        $("#laKaLaCallback").attr("required", "");
    } else {
        $("#laKaLaCallbacks").hide();
        $("#laKaLaCallback").removeAttr("name");
        $("#laKaLaCallback").removeAttr("required");
    }
}

$("#psbcType").change(function () {
    var reslist = $("#psbcType").select2("data");
    $("#psbcTypes").val(payTypes(reslist));
});
$("#saobeiType").change(function () {
    var reslist = $("#saobeiType").select2("data");
    $("#saobeiTypes").val(payTypes(reslist));
});
$("#haikeType").change(function () {
    var reslist = $("#haikeType").select2("data");
    $("#haikeTypes").val(payTypes(reslist));
});
$("#fuyouType").change(function () {
    var reslist = $("#fuyouType").select2("data");
    $("#fuyouTypes").val(payTypes(reslist));
});
$("#longzhimengType").change(function () {
    var reslist = $("#longzhimengType").select2("data");
    $("#longzhimengTypes").val(payTypes(reslist));
});


//给支付宝的input赋值
function zhifubao(i) {
    $("#appID1").attr("name", "payCompanyInfos[" + i + "].zfbPayJsonVo.appID");
    $("#pid").attr("name", "payCompanyInfos[" + i + "].zfbPayJsonVo.pid");
    $("#privateKey").attr("name", "payCompanyInfos[" + i + "].zfbPayJsonVo.privateKey");
    $("#publicKey").attr("name", "payCompanyInfos[" + i + "].zfbPayJsonVo.publicKey");
    $("#alipayPublicKey").attr("name", "payCompanyInfos[" + i + "].zfbPayJsonVo.alipayPublicKey");
    $("#remark1").attr("name", "payCompanyInfos[" + i + "].remark");
    $("#payType2").attr("name", "payCompanyInfos[" + i + "].payType");

    $("#zpaytype").attr("data-placeholder", "请从列表选择一项");
    $("#zpaytype").attr("required", "");
    $("#appID1").attr("required", "");
    $("#pid").attr("required", "");
    $("#privateKey").attr("required", "");
    $("#publicKey").attr("required", "");
    $("#alipayPublicKey").attr("required", "");

    $("#aliIsCallback").val(i);
}

//支付宝
//是不需要子商户，隐藏子商户
function aliIsbuZiShangHu() {
    //隐藏微信的字商户
    $("#sysServiceProviderIdS").hide();
    $("#sysServiceProviderId").removeAttr("name");
    $("#sysServiceProviderId").removeAttr("required");
}

function aliIsZiShangHu() {
    //显示支付宝的字商户 WXChildAppID
    $("#sysServiceProviderIdS").show();
    $("#sysServiceProviderId").attr("name", "payCompanyInfos[" + $("#aliIsCallback").val() + "].zfbPayJsonVo.sysServiceProviderId");
    $("#sysServiceProviderId").attr("required", "");
}

//给工行聚合支付赋值
function icbc(i) {
    $("#icbcAppId").attr("name", "payCompanyInfos[" + i + "].icbcVo.appId");
    $("#merSerId").attr("name", "payCompanyInfos[" + i + "].icbcVo.merSerId");
    $("#merSerPrtclNo").attr("name", "payCompanyInfos[" + i + "].icbcVo.merSerPrtclNo");
    //$("#icbcMchid").attr("name","payCompanyInfos["+i+"].icbcVo.merId");
    $("#icbcPrivateKey").attr("name", "payCompanyInfos[" + i + "].icbcVo.privateKey");
    $("#icbcPublicKey").attr("name", "payCompanyInfos[" + i + "].icbcVo.publicKey");
    $("#icbcPayType").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#icbcRemark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#icbcPayTypeselect").attr("data-placeholder", "请从列表选择一项");
    $("#icbcPayTypeselect").attr("required", "");
    $("#icbcAppId").attr("required", "");
    $("#merSerId").attr("required", "");
    $("#merSerPrtclNo").attr("required", "");
    //$("#icbcMchid").attr("required","");
    $("#icbcPrivateKey").attr("required", "");
    $("#icbcPublicKey").attr("required", "");
}

//给银联支付赋值
function union(i) {
    $("#mchid1").attr("name", "payCompanyInfos[" + i + "].unionJsonPayVo.mchid");
    $("#key1").attr("name", "payCompanyInfos[" + i + "].unionJsonPayVo.key");
    $("#payType3").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#remark2").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#unionpaytype").attr("data-placeholder", "请从列表选择一项");
    $("#unionpaytype").attr("required", "");
    $("#mchid1").attr("required", "");
    $("#key1").attr("required", "");

    $("#unionIsCallback").val(i);
}

//给青岛农商赋值
function qingdaonongshang(i) {
    $("#commid").attr("name", "payCompanyInfos[" + i + "].qingDaoNongShangJsonVo.commid");
    $("#commoperid").attr("name", "payCompanyInfos[" + i + "].qingDaoNongShangJsonVo.commoperid");
    $("#commstoreno").attr("name", "payCompanyInfos[" + i + "].qingDaoNongShangJsonVo.commstoreno");
    $("#devsn").attr("name", "payCompanyInfos[" + i + "].qingDaoNongShangJsonVo.devsn");
    $("#qingDaoNongShangkey").attr("name", "payCompanyInfos[" + i + "].qingDaoNongShangJsonVo.key");

    $("#payType4").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#remark3").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#qingDaoNongShangtype").attr("data-placeholder", "请从列表选择一项");
    $("#qingDaoNongShangtype").attr("required", "");
    $("#commid").attr("required", "");
    $("#commoperid").attr("required", "");
    $("#commstoreno").attr("required", "");
    $("#devsn").attr("required", "");
    $("#qingDaoNongShangkey").attr("required", "");
}

//收钱吧
function shouqianba(i) {
    $("#terminal_sn").attr("name", "payCompanyInfos[" + i + "].shouQianBaVo.terminal_sn");
    $("#terminal_key").attr("name", "payCompanyInfos[" + i + "].shouQianBaVo.terminal_key");

    $("#ShouQianBaPayTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#remark4").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#ShouQianBaPayType").attr("data-placeholder", "请从列表选择一项");
    $("#ShouQianBaPayType").attr("required", "");
    $("#terminal_sn").attr("required", "");
    $("#terminal_key").attr("required", "");
}

//龙支付
function ccbbs(i) {
    $("#ccbbChecked").val(i);
    $("#ccbbPayTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#ccbbremark").attr("name", "payCompanyInfos[" + i + "].remark");
    $("#ccbbPayType").attr("data-placeholder", "请从列表选择一项");
    $("#ccbbPayType").attr("required", "");
}

function checkboxOnclick(checkbox) {
    if (checkbox.checked == true) {
        $("#MERCHANTID").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.MERCHANTID");
        $("#POSID").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.POSID");
        $("#BRANCHID").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.BRANCHID");
        $("#ccbbPubKey").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.publicKey");
        $("#USERID").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.USERID");
        $("#ccbbPASSWORD").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.PASSWORD");
        $("#port").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.port");

        $("#MERCHANTID").attr("required", "");
        $("#POSID").attr("required", "");
        $("#BRANCHID").attr("required", "");
        $("#ccbbPubKey").attr("required", "");
        $("#USERID").attr("required", "");
        $("#ccbbPASSWORD").attr("required", "");
        $("#port").attr("required", "");
        $("#aggregation").show();
    } else {
        $("#MERCHANTID").removeAttr("required");
        $("#POSID").removeAttr("required");
        $("#BRANCHID").removeAttr("required");
        $("#ccbbPubKey").removeAttr("required");
        $("#USERID").removeAttr("required");
        $("#PASSWORD").removeAttr("required");
        $("#port").removeAttr("required");

        $("#MERCHANTID").removeAttr("name");
        $("#POSID").removeAttr("name");
        $("#BRANCHID").removeAttr("name");
        $("#ccbbPubKey").removeAttr("name");
        $("#USERID").removeAttr("name");
        $("#PASSWORD").removeAttr("name");
        $("#port").removeAttr("name");
        $("#aggregation").hide();
    }
}

function checkboxTwoclick(checkbox) {
    if (checkbox.checked == true) {
        $("#DCMERCHANTID").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.DCMERCHANTID");
        $("#DCPOSID").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.DCPOSID");
        $("#DCBRANCHID").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.DCBRANCHID");
        $("#ccbbDCPubKey").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.DCpublicKey");
        $("#DCpubKey1").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.DCpubKey1");
        $("#DCpriKey1").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.DCpriKey1");
        $("#DCpubKey2").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.DCpubKey2");
        $("#DCFTCORPID").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.DCFTCORPID");
        $("#DCUSERID").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.DCUSERID");
        $("#DCPASSWORD").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.DCPASSWORD");

        $("#DCMERCHANTID").attr("required", "");
        $("#DCPOSID").attr("required", "");
        $("#DCBRANCHID").attr("required", "");
        $("#ccbbDCPubKey").attr("required", "");
        $("#DCpubKey1").attr("required", "");
        $("#DCpriKey1").attr("required", "");
        $("#DCpubKey2").attr("required", "");
        $("#DCFTCORPID").attr("required", "");
        $("#DCUSERID").attr("required", "");
        $("#DCPASSWORD").attr("required", "");
        $("#DC").show();
    } else {
        $("#DCMERCHANTID").removeAttr("required");
        $("#DCPOSID").removeAttr("required");
        $("#DCBRANCHID").removeAttr("required");
        $("#ccbbDCPubKey").removeAttr("required");
        $("#DCpubKey1").removeAttr("required");
        $("#DCpriKey1").removeAttr("required");
        $("#DCpubKey2").removeAttr("required");
        $("#DCFTCORPID").removeAttr("required");
        $("#DCUSERID").removeAttr("required");
        $("#DCPASSWORD").removeAttr("required");

        $("#DCMERCHANTID").removeAttr("name");
        $("#DCPOSID").removeAttr("name");
        $("#DCBRANCHID").removeAttr("name");
        $("#ccbbDCPubKey").removeAttr("name");
        $("#DCpubKey1").removeAttr("name");
        $("#DCpriKey1").removeAttr("name");
        $("#DCpubKey2").removeAttr("name");
        $("#DCFTCORPID").removeAttr("name");
        $("#DCUSERID").removeAttr("name");
        $("#DCPASSWORD").removeAttr("name");
        $("#DC").hide();
    }
}

function checkboxThreeclick(checkbox) {
    if (checkbox.checked == true) {
        $("#appidUNIONPAYPS").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.appId");
        $("#appkeyUNIONPAYPS").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.appKey");
        $("#merchantCodeUNIONPAYPS").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.merchantCode");
        $("#terminalCodeUNIONPAYPS").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.terminalCode");

        $("#appidUNIONPAYPS").attr("required", "");
        $("#appkeyUNIONPAYPS").attr("required", "");
        $("#merchantCodeUNIONPAYPS").attr("required", "");
        $("#terminalCodeUNIONPAYPS").attr("required", "");
        $("#UNIONPAYPS").show();
    } else {
        $("#appidUNIONPAYPS").removeAttr("required");
        $("#appkeyUNIONPAYPS").removeAttr("required");
        $("#merchantCodeUNIONPAYPS").removeAttr("required");
        $("#terminalCodeUNIONPAYPS").removeAttr("required");

        $("#appidUNIONPAYPS").removeAttr("name");
        $("#appkeyUNIONPAYPS").removeAttr("name");
        $("#merchantCodeUNIONPAYPS").removeAttr("name");
        $("#terminalCodeUNIONPAYPS").removeAttr("name");
        $("#UNIONPAYPS").hide();
    }
}

function checkboxFourclick(checkbox) {
    if (checkbox.checked == true) {
        $("#mchIdSCANPAY").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.scan_mchtNo");
        $("#termNoSCANPAY").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.scan_termNo");
        $("#posIdSCANPAY").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.scan_posId");
        $("#keySCANPAY").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.scan_key");
        $("#authcodeSCANPAY").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.scan_authCode");


        $("#SCANPAY").show();
    } else {
        $("#mchIdSCANPAY").removeAttr("required");
        $("#termNoSCANPAY").removeAttr("required");
        $("#posIdSCANPAY").removeAttr("required");
        $("#keySCANPAY").removeAttr("required");
        $("#authcodeSCANPAY").removeAttr("required");

        $("#mchIdSCANPAY").removeAttr("name");
        $("#termNoSCANPAY").removeAttr("name");
        $("#posIdSCANPAY").removeAttr("name");
        $("#keySCANPAY").removeAttr("name");
        $("#authcodeSCANPAY").removeAttr("name");
        $("#SCANPAY").hide();
    }
}

/**
 * 下载建行秘钥
 */
function download_ccb_sk_click() {

    var mchtNo = $("#mchIdSCANPAY").val()
    var termNo = $("#termNoSCANPAY").val()
    var authCode = $("#authcodeSCANPAY").val()
    var postId = $("#posIdSCANPAY").val()

    $.post({
        url: "/ocom_admin/ccb/downloadsk",
        contentType: "application/json",

        data: JSON.stringify({"mchtNo": mchtNo, "termNo": termNo, "posId": postId, "authCode": authCode}),
        success: function (response) {
            if (response.code == 200) {
                //处理数据
                $("#keySCANPAY").val(response.data.scan_key)
                alert("下载成功")
                console.log($("#keySCANPAY").val())

            } else {
                alert(response.msg)
            }

        },
        error: function (xhr, status, error) {
            // 处理错误响应
            alert(status);
            console.log(xhr)
            console.log(status)
            console.log(error)
        }
    });

}

//移领支付
function kanclouds(i) {
    $("#merchantNum").attr("name", "payCompanyInfos[" + i + "].kancloudVo.merchant_num");
    $("#kancloudKey").attr("name", "payCompanyInfos[" + i + "].kancloudVo.key");


    $("#kancloudTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#kancloudRemark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#kancloudType").attr("data-placeholder", "请从列表选择一项");
    $("#kancloudType").attr("required", "");
    $("#merchantNum").attr("required", "");
    $("#kancloudKey").attr("required", "");
}

//乐刷
function leshua(i) {
    $("#leshuamerchantId").attr("name", "payCompanyInfos[" + i + "].leShua.merchant_id");
    $("#leshuaKey").attr("name", "payCompanyInfos[" + i + "].leShua.key");


    $("#leshuaTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#leshuaRemark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#leshuaType").attr("data-placeholder", "请从列表选择一项");
    $("#leshuaType").attr("required", "");
    $("#leshuamerchantId").attr("required", "");
    $("#leshuaKey").attr("required", "");
}

//大华捷通
function chinaums(i) {
    $("#chinaumsmerchantId").attr("name", "payCompanyInfos[" + i + "].chinaums.merid");
    $("#chinaumsdevsn").attr("name", "payCompanyInfos[" + i + "].chinaums.devsn");
    $("#chinaumsKey").attr("name", "payCompanyInfos[" + i + "].chinaums.key");


    $("#chinaumsTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#chinaumsRemark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#chinaumsType").attr("data-placeholder", "请从列表选择一项");
    $("#chinaumsType").attr("required", "");
    $("#chinaumsmerchantId").attr("required", "");
    $("#chinaumsdevsn").attr("required", "");
    $("#chinaumsKey").attr("required", "");

    $("#chinaumsIsCallback").val(i);
}

//银联校园版
function unionschool(i) {
    $("#unionschoolBrandId").attr("name", "payCompanyInfos[" + i + "].unionSchool.brand_id");
    $("#unionschoolOpshopId").attr("name", "payCompanyInfos[" + i + "].unionSchool.op_shop_id");
    $("#unionschoolBussType").attr("name", "payCompanyInfos[" + i + "].unionSchool.buss_type");
    $("#unionschoolKey").attr("name", "payCompanyInfos[" + i + "].unionSchool.key");


    $("#unionschoolTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#unionschoolRemark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#unionschoolType").attr("data-placeholder", "请从列表选择一项");
    $("#unionschoolType").attr("required", "");
    $("#unionschoolBrandId").attr("required", "");
    $("#unionschoolOpshopId").attr("required", "");
    $("#unionschoolBussType").attr("required", "");
    $("#unionschoolKey").attr("required", "");

    $("#unionschoolIsCallback").val(i);
}

//天阙聚合支付
function TianQueTech(i) {
    $("#TianQueTechMerchants").attr("name", "payCompanyInfos[" + i + "].tianQueTechVo.mno");
    $("#TianQueTechPrivateKey").attr("name", "payCompanyInfos[" + i + "].tianQueTechVo.privateKey");
    $("#TianQueTechSxfPublic").attr("name", "payCompanyInfos[" + i + "].tianQueTechVo.sxfPublic");


    $("#TianQueTechTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#TianQueTechRemark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#TianQueTechType").attr("data-placeholder", "请从列表选择一项");
    $("#TianQueTechType").attr("required", "");
    $("#TianQueTechMerchants").attr("required", "");
    $("#TianQueTechPrivateKey").attr("required", "");
    $("#TianQueTechSxfPublic").attr("required", "");

    $("#unionschoolIsCallback").val(i);
}

//付惠吧
function FuHuiBa(i) {
    $("#FuHuiBaKey").attr("name", "payCompanyInfos[" + i + "].fuHuiBaVo.key");


    $("#FuHuiBaTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#FuHuiBaRemark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#FuHuiBaType").attr("data-placeholder", "请从列表选择一项");
    $("#FuHuiBaType").attr("required", "");
    $("#FuHuiBaKey").attr("required", "");
}

//江苏昆山农商银行
function ksrcb(i) {
    $("#ksrcbSubMerNo").attr("name", "payCompanyInfos[" + i + "].ksrcbVo.subMerNo");
    $("#ksrcbSubMerName").attr("name", "payCompanyInfos[" + i + "].ksrcbVo.subMerName");
    $("#ksrcbMerStoreNo").attr("name", "payCompanyInfos[" + i + "].ksrcbVo.MerStoreNo");


    $("#ksrcbTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#ksrcbRemark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#ksrcbType").attr("data-placeholder", "请从列表选择一项");
    $("#ksrcbType").attr("required", "");
    $("#ksrcbSubMerNo").attr("required", "");
    $("#ksrcbSubMerName").attr("required", "");
    $("#ksrcbMerStoreNo").attr("required", "");
}

//给随行付赋值
function SuiXingPay(i) {
    $("#mno").attr("name", "payCompanyInfos[" + i + "].suiXingPay.mno");
    $("#poundage").attr("name", "payCompanyInfos[" + i + "].suiXingPay.poundage");
    $("#startSigning").attr("name", "payCompanyInfos[" + i + "].suiXingPay.qrStart");
    $("#SuiXingPaytypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#SuiXingPayremark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#SuiXingPaytype").attr("data-placeholder", "请从列表选择一项");
    $("#SuiXingPaytype").attr("required", "");
    $("#mno").attr("required", "");

    $("#SuiXingPayIsCallback").val(i);
}

//给中国银行赋值
function abc(i) {
    $("#abcmerchantID").attr("name", "payCompanyInfos[" + i + "].abc.merchantID");
    $("#abcmerchantPrivateKey").attr("name", "payCompanyInfos[" + i + "].abc.merchantPrivateKey");
    $("#receiveAccount").attr("name", "payCompanyInfos[" + i + "].abc.receiveAccount");
    $("#terminalNo").attr("name", "payCompanyInfos[" + i + "].abc.terminalNo");
    $("#abcTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#abcRemark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#abcbType").attr("data-placeholder", "请从列表选择一项");
    $("#abcbType").attr("required", "");
    $("#abcmerchantID").attr("required", "");
    $("#abcmerchantPrivateKey").attr("required", "");
    $("#terminalNo").attr("required", "");
}

//轻松付
function qsf(i) {
    $("#qsfappID").attr("name", "payCompanyInfos[" + i + "].qsf.appid");
    $("#qsfmchid").attr("name", "payCompanyInfos[" + i + "].qsf.mchid");
    $("#qsfmchSerialNo").attr("name", "payCompanyInfos[" + i + "].qsf.mchSerialNo");
    $("#qsfcertificate").attr("name", "payCompanyInfos[" + i + "].qsf.certificate");
    $("#wechatpaySerial").attr("name", "payCompanyInfos[" + i + "].qsf.wechatpaySerial");
    $("#apiV3Key").attr("name", "payCompanyInfos[" + i + "].qsf.apiV3Key");
    $("#wxChannel").attr("name", "payCompanyInfos[" + i + "].qsf.wx_channel");
    $("#qsfprivateKey").attr("name", "payCompanyInfos[" + i + "].qsf.privateKey");
    $("#qsfSchoolId").attr("name", "payCompanyInfos[" + i + "].qsf.schoolId");
    $("#qsfOrganizationId").attr("name", "payCompanyInfos[" + i + "].qsf.organizationId");
    $("#qsfkey").attr("name", "payCompanyInfos[" + i + "].qsf.key");
    $("#qsftypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#qsfremark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#qsftype").attr("data-placeholder", "请从列表选择一项");
    $("#qsftype").attr("required", "");
    $("#qsfappID").attr("required", "");
    $("#qsfmchid").attr("required", "");
    $("#qsfmchSerialNo").attr("required", "");
    $("#qsfcertificate").attr("required", "");
    $("#wechatpaySerial").attr("required", "");
    $("#apiV3Key").attr("required", "");
    $("#wxChannel").attr("required", "");
    $("#qsfprivateKey").attr("required", "");

    //判断是否需要子商户
    $("#qsfIsCallback").val(i);
    var val = $('input:radio[name="qsfIsEvery"]:checked').val();
    if (val == "1") {
        qsfIsZiShangHu();
    }
}

function qsfIsZiShangHu() {
    //显示微信的字商户 WXChildAppID
    $("#qsfZiAppID").show();
    $("#qsfChildAppID").attr("name", "payCompanyInfos[" + $("#qsfIsCallback").val() + "].qsf.sub_appid");
    $("#qsfChildAppID").attr("required", "");

    $("#qsfsubMchids").show();
    $("#qsfSubMchid").attr("name", "payCompanyInfos[" + $("#qsfIsCallback").val() + "].qsf.sub_mchid");
    $("#qsfSubMchid").attr("required", "");
}

//是不需要子商户，隐藏子商户
function qsfIsbuZiShangHu() {
    //隐藏轻松付的字商户
    $("#qsfZiAppID").hide();
    $("#qsfChildAppID").removeAttr("name");
    $("#qsfChildAppID").removeAttr("required");

    $("#qsfsubMchids").hide();
    $("#qsfSubMchid").removeAttr("name");
    $("#qsfSubMchid").removeAttr("required");
}

//给盛灿赋值
function ShengCan(i) {
    $("#ShengCanSchoolNo").attr("name", "payCompanyInfos[" + i + "].shengCan.schoolNo");
    $("#ShengCankey").attr("name", "payCompanyInfos[" + i + "].shengCan.key");
    $("#ShengCantypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#ShengCanremark").attr("name", "payCompanyInfos[" + i + "].remark");


    $("#ShengCantype").attr("data-placeholder", "请从列表选择一项");
    $("#ShengCantype").attr("required", "");
    $("#ShengCanSchoolNo").attr("required", "");
    $("#ShengCankey").attr("required", "");
}

//给盛灿赋值
function POSTong(i) {
    $("#POSTongappid").attr("name", "payCompanyInfos[" + i + "].posTong.appid");
    $("#POSTongappkey").attr("name", "payCompanyInfos[" + i + "].posTong.appkey");
    $("#POSTongmerchantCode").attr("name", "payCompanyInfos[" + i + "].posTong.merchantCode");
    $("#POSTongterminalCode").attr("name", "payCompanyInfos[" + i + "].posTong.terminalCode");
    $("#POSTongtypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#POSTongremark").attr("name", "payCompanyInfos[" + i + "].remark");


    $("#POSTongtype").attr("data-placeholder", "请从列表选择一项");
    $("#POSTongtype").attr("required", "");
    $("#POSTongappid").attr("required", "");
    $("#POSTongappkey").attr("required", "");
    $("#POSTongmerchantCode").attr("required", "");
    $("#POSTongterminalCode").attr("required", "");
}

//给汇银通POS赋值
function HuiYinTong(i) {
    $("#InstNo").attr("name", "payCompanyInfos[" + i + "].huiYinTong.InstNo");
    $("#MerchId").attr("name", "payCompanyInfos[" + i + "].huiYinTong.MerchId");
    $("#TermId").attr("name", "payCompanyInfos[" + i + "].huiYinTong.TermId");
    $("#huiYinTongKey").attr("name", "payCompanyInfos[" + i + "].huiYinTong.key");
    $("#huiYinTongTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#huiYinTongremark").attr("name", "payCompanyInfos[" + i + "].remark");


    $("#huiYinTongType").attr("data-placeholder", "请从列表选择一项");
    $("#huiYinTongType").attr("required", "");
    $("#InstNo").attr("required", "");
    $("#MerchId").attr("required", "");
    $("#TermId").attr("required", "");
    $("#huiYinTongKey").attr("required", "");
}

//交通银行
function bocom(i) {
    $("#bocomMerPtcId").attr("name", "payCompanyInfos[" + i + "].bocom.merPtcId");
    $("#bocomAppID").attr("name", "payCompanyInfos[" + i + "].bocom.appID");
    $("#myPrivateKey").attr("name", "payCompanyInfos[" + i + "].bocom.myPrivateKey");
    $("#apigwPublicKey").attr("name", "payCompanyInfos[" + i + "].bocom.apigwPublicKey");
    $("#bocomTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#bocomRemark").attr("name", "payCompanyInfos[" + i + "].remark");


    $("#bocomType").attr("data-placeholder", "请从列表选择一项");
    $("#bocomType").attr("required", "");
    $("#bocomMerPtcId").attr("required", "");
    $("#bocomAppID").attr("required", "");
    $("#myPrivateKey").attr("required", "");
    $("#apigwPublicKey").attr("required", "");


    $("#bocomIsCallback").val(i);
}

//给杉德河马付赋值
function SandHippo(i) {
    $("#SandHippoAppId").attr("name", "payCompanyInfos[" + i + "].sandHippoVo.appId");
    $("#SandHippoPrivateKey").attr("name", "payCompanyInfos[" + i + "].sandHippoVo.privateKey");
    $("#platPublicKey").attr("name", "payCompanyInfos[" + i + "].sandHippoVo.platPublicKey");
    $("#storeId").attr("name", "payCompanyInfos[" + i + "].sandHippoVo.storeId");
    $("#SandHippoSubAppId").attr("name", "payCompanyInfos[" + i + "].sandHippoVo.subAppId");
    $("#SandHippoTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#SandHippoRemark").attr("name", "payCompanyInfos[" + i + "].remark");


    $("#SandHippoType").attr("data-placeholder", "请从列表选择一项");
    $("#SandHippoType").attr("required", "");
    $("#SandHippoAppId").attr("required", "");
    $("#SandHippoPrivateKey").attr("required", "");
    $("#platPublicKey").attr("required", "");
    $("#storeId").attr("required", "");
}

//拉卡拉
function laKaLa(i) {
    $("#laKaLaAppid").attr("name", "payCompanyInfos[" + i + "].laKaLaVo.appid");
    $("#laKaLaMchSerialNo").attr("name", "payCompanyInfos[" + i + "].laKaLaVo.mchSerialNo");
    $("#laKaLaMerchantNo").attr("name", "payCompanyInfos[" + i + "].laKaLaVo.merchantNo");
    $("#laKaLaTermNo").attr("name", "payCompanyInfos[" + i + "].laKaLaVo.termNo");
    $("#laKaLaTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#laKaLaRemark").attr("name", "payCompanyInfos[" + i + "].remark");


    $("#laKaLaType").attr("data-placeholder", "请从列表选择一项");
    $("#laKaLaType").attr("required", "");
    $("#laKaLaAppid").attr("required", "");
    $("#laKaLaMchSerialNo").attr("required", "");
    $("#laKaLaMerchantNo").attr("required", "");
    $("#laKaLaTermNo").attr("required", "");


    $("#laKaLaIsCallback").val(i);
}

//邮政银行
function psbc(i) {
    $("#psbcMercId").attr("name", "payCompanyInfos[" + i + "].psbc.mercId");
    $("#psbcTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#psbcRemark").attr("name", "payCompanyInfos[" + i + "].remark");


    $("#psbcType").attr("data-placeholder", "请从列表选择一项");
    $("#psbcType").attr("required", "");
    $("#psbcMercId").attr("required", "");
    //$("#laKaLaIsCallback").val(i);
}

//扫呗
function saobei(i) {
    $("#saobeiMerchantNo").attr("name", "payCompanyInfos[" + i + "].saoBei.merchantNo");
    $("#saobeiTerminalId").attr("name", "payCompanyInfos[" + i + "].saoBei.terminalId");
    $("#saobeiTokenKey").attr("name", "payCompanyInfos[" + i + "].saoBei.tokenKey");
    $("#saobeiTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#saobeiRemark").attr("name", "payCompanyInfos[" + i + "].remark");


    $("#saobeiType").attr("data-placeholder", "请从列表选择一项");
    $("#saobeiType").attr("required", "");
    $("#saobeiMerchantNo").attr("required", "");
    $("#saobeiTerminalId").attr("required", "");
    $("#saobeiTokenKey").attr("required", "");
    //$("#laKaLaIsCallback").val(i);
}

//嗨客
function haike(i) {
    $("#haikemerchantNum").attr("name", "payCompanyInfos[" + i + "].haiKeVo.merchantNum");
    $("#haikeappid").attr("name", "payCompanyInfos[" + i + "].haiKeVo.appid");
    $("#haikestoreNum").attr("name", "payCompanyInfos[" + i + "].haiKeVo.storeNum");
    $("#haikestaffNum").attr("name", "payCompanyInfos[" + i + "].haiKeVo.staffNum");
    $("#haikekey").attr("name", "payCompanyInfos[" + i + "].haiKeVo.key");
    $("#haikeTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#haikeRemark").attr("name", "payCompanyInfos[" + i + "].remark");


    $("#haikeType").attr("data-placeholder", "请从列表选择一项");
    $("#haikeType").attr("required", "");
    $("#haikemerchantNum").attr("required", "");
    $("#haikeappid").attr("required", "");
    $("#haikestoreNum").attr("required", "");
    $("#haikestaffNum").attr("required", "");
    $("#haikekey").attr("required", "");
    //$("#laKaLaIsCallback").val(i);
}

//富有
function fuyou(i) {
    $("#fuyoumchntCd").attr("name", "payCompanyInfos[" + i + "].fuYouVo.mchntCd");
    $("#fuyouTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#fuyouRemark").attr("name", "payCompanyInfos[" + i + "].remark");


    $("#fuyouPayType").attr("data-placeholder", "请从列表选择一项");
    $("#fuyouPayType").attr("required", "");
    $("#fuyouRemark").attr("required", "");
    //$("#laKaLaIsCallback").val(i);
}

//进钱吧
function longzhimeng(i) {
    $("#longzhimengmchId").attr("name", "payCompanyInfos[" + i + "].longZhiMengVo.mchId");
    $("#longzhimengappid").attr("name", "payCompanyInfos[" + i + "].longZhiMengVo.appid");
    $("#longzhimengmd5").attr("name", "payCompanyInfos[" + i + "].longZhiMengVo.md5");

    $("#longzhimengTypes").attr("name", "payCompanyInfos[" + i + "].payType");

    $("#longzhimengPayType").attr("data-placeholder", "请从列表选择一项");
    $("#longzhimengPayType").attr("required", "");
}


//微信
//给微信赋值
function editweixin(i) {
    $("#editappID").attr("name", "payCompanyInfos[" + i + "].wxPayJsonVo.appID");
    $("#editmchid").attr("name", "payCompanyInfos[" + i + "].wxPayJsonVo.mchid");
    $("#editkey").attr("name", "payCompanyInfos[" + i + "].wxPayJsonVo.key");
    $("#editAppSecret").attr("name", "payCompanyInfos[" + i + "].wxPayJsonVo.appSecret");
    $("#editremark").attr("name", "payCompanyInfos[" + i + "].remark");
    $("#editpayType").attr("name", "payCompanyInfos[" + i + "].payType");

    $("#editpaytype1").attr("data-placeholder", "请从列表选择一项");
    $("#editpaytype1").attr("required", "");
    $("#editappID").attr("required", "");
    $("#editmchid").attr("required", "");
    $("#editkey").attr("required", "");

    //判断是否需要子商户
    $("#editwxIsCallback").val(i);
    var val = $('input:radio[name="editwxIsEvery"]:checked').val();
    if (val == "1") {
        editwxIsZiShangHu();
    }
    //判断是否有回调地址
    var reslist = $("#editpaytype1").select2("data");
    var payTypeString = payTypes(reslist);
    $("#editpayType").val(payTypeString);
    editWXcallback(payTypeString);
}

//选中那个支付方式，把对应的值赋值给隐藏的文本框
$("#editpaytype1").change(function () {
    var reslist = $("#editpaytype1").select2("data");
    var payTypeString = payTypes(reslist);
    $("#editpayType").val(payTypeString);
    editWXcallback(payTypeString);
});

//判断是否需要回调地址
function editWXcallback(payTypeString) {
    if (payTypeString.substr(0, 1) == "1" || payTypeString.substr(2, 1) == "1"
        || payTypeString.substr(3, 1) == "1") {
        $("#editwxCallbacks").show();
        $("#editWXCallback").attr("name", "payCompanyInfos[" + $("#editwxIsCallback").val() + "].wxPayJsonVo.callbackAddress");
        $("#editWXCallback").attr("required", "");
    } else {
        $("#editwxCallbacks").hide();
        $("#editWXCallback").removeAttr("name");
        $("#editWXCallback").removeAttr("required");
    }
}

//是不需要子商户，隐藏子商户
function editwxIsbuZiShangHu() {
    //隐藏微信的字商户
    $("#editwxZiAppID").hide();
    $("#editWXChildAppID").removeAttr("name");
    $("#editWXChildAppID").removeAttr("required");
}

function editwxIsZiShangHu() {
    //显示微信的字商户 WXChildAppID
    $("#editwxZiAppID").show();
    $("#editWXChildAppID").attr("name", "payCompanyInfos[" + $("#editwxIsCallback").val() + "].wxPayJsonVo.childMerchants");
    $("#editWXChildAppID").attr("required", "");
}

//选中那个支付方式，把对应的值赋值给隐藏的文本框
$("#editzpaytype").change(function () {
    var reslist = $("#editzpaytype").select2("data");
    var payTypeString = payTypes(reslist);
    $("#editpayType2").val(payTypeString);
    editalicallback(payTypeString);
});


//判断是否需要回调地址
function editalicallback(payTypeString) {
    if (payTypeString.substr(0, 1) == "1" || payTypeString.substr(2, 1) == "1"
        || payTypeString.substr(3, 1) == "1") {
        $("#editaliCallbacks").show();
        $("#editaliCallback").attr("name", "payCompanyInfos[" + $("#editaliIsCallback").val() + "].zfbPayJsonVo.callbackAddress");
        $("#editaliCallback").attr("required", "");
    } else {
        $("#editaliCallbacks").hide();
        $("#editaliCallback").removeAttr("name");
        $("#editaliCallback").removeAttr("required");
    }
}

$("#editicbcPayTypeselect").change(function () {
    var reslist = $("#editicbcPayTypeselect").select2("data");
    $("#editicbcPayType").val(payTypes(reslist));
});

$("#editqingDaoNongShangtype").change(function () {
    var reslist = $("#editqingDaoNongShangtype").select2("data");
    $("#editpayType4").val(payTypes(reslist));
});
$("#editShouQianBaPayType").change(function () {
    var reslist = $("#editShouQianBaPayType").select2("data");
    $("#editShouQianBaPayTypes").val(payTypes(reslist));
});

$("#editccbbPayType").change(function () {
    var reslist = $("#editccbbPayType").select2("data");
    var payTypeString = payTypes(reslist);
    editccbbcallbackg(payTypeString);
    $("#editccbbPayTypes").val(payTypeString);
});

function editccbbcallbackg(payTypeString) {
    if (payTypeString.substr(0, 1) == "1" || payTypeString.substr(2, 1) == "1"
        || payTypeString.substr(3, 1) == "1") {
        $("#editccbbCallbacks").show();
        $("#editccbbCallback").attr("name", "payCompanyInfos[" + $("#editccbbChecked").val() + "].ccbbVo.callbackAddress");
        $("#editccbbCallback").attr("required", "");
        $("#editccbbAPPID").attr("name", "payCompanyInfos[" + $("#editccbbChecked").val() + "].ccbbVo.wxappid");
        $("#editccbbAPPID").attr("required", "");
    } else {
        $("#editccbbCallbacks").hide();
        $("#editccbbCallback").removeAttr("name");
        $("#editccbbCallback").removeAttr("required");
        $("#editccbbAPPID").removeAttr("name");
        $("#editccbbAPPID").removeAttr("required");
    }
}


$("#editkancloudType").change(function () {
    var reslist = $("#editkancloudType").select2("data");
    $("#editkancloudTypes").val(payTypes(reslist));
});
$("#editleshuaType").change(function () {
    var reslist = $("#editleshuaType").select2("data");
    $("#editleshuaTypes").val(payTypes(reslist));
});
$("#editchinaumsType").change(function () {
    var reslist = $("#chinaumsType").select2("data");
    var payTypeString = payTypes(reslist);
    editchinaumsCallback(payTypeString);
    $("#chinaumsTypes").val(payTypeString);
});

//隐藏支付渠道，选择不需要隐藏
function editispayvisible(i) {
    if (i == 1) {
        edityin();

        $("#edittype").val(null).trigger("change");
        $("#edittype").removeAttr("data-placeholder");
        $("#edittype").removeAttr("required");
        $("#editpayChannel").val("00000000000000000000");

    } else {
        $("#editpayChannel").attr("name", "payChannel");
        $("#edittype").attr("data-placeholder", "请从列表选择一项");
        $("#edittype").attr("required", "");
        $("#editZFQD").show()
    }
}

$("#editunionpaytype").change(function () {
    var reslist = $("#editunionpaytype").select2("data");
    var payTypeString = payTypes(reslist);
    editunionpayCallback(payTypeString);
    $("#editpayType3").val(payTypeString);
});

//判断是否需要回调地址
function editunionpayCallback(payTypeString) {
    if (payTypeString.substr(0, 1) == "1" || payTypeString.substr(2, 1) == "1"
        || payTypeString.substr(3, 1) == "1") {
        $("#editunionCallbacks").show();
        $("#editunionCallback").attr("name", "payCompanyInfos[" + $("#editunionIsCallback").val() + "].unionJsonPayVo.callbackAddress");
        $("#editunionCallback").attr("required", "");
    } else {
        $("#editunionCallbacks").hide();
        $("#editunionCallback").removeAttr("name");
        $("#editunionCallback").removeAttr("required");
    }
}


$("#editchinaumsType").change(function () {
    var reslist = $("#editchinaumsType").select2("data");
    var payTypeString = payTypes(reslist);
    editchinaumsCallback(payTypeString);
    $("#editchinaumsTypes").val(payTypeString);
});

//判断是否需要回调地址
function editchinaumsCallback(payTypeString) {
    if (payTypeString.substr(0, 1) == "1" || payTypeString.substr(2, 1) == "1"
        || payTypeString.substr(3, 1) == "1") {
        $("#editchinaumsCallbacks").show();
        $("#editchinaumsCallback").attr("name", "payCompanyInfos[" + $("#editchinaumsIsCallback").val() + "].chinaums.callbackAddress");
        $("#editchinaumsCallback").attr("required", "");
    } else {
        $("#editchinaumsCallbacks").hide();
        $("#editchinaumsCallback").removeAttr("name");
        $("#editchinaumsCallback").removeAttr("required");
    }
}

$("#editunionschoolType").change(function () {
    var reslist = $("#editunionschoolType").select2("data");
    var payTypeString = payTypes(reslist);
    editunionschoolCallback(payTypeString);
    $("#editunionschoolTypes").val(payTypeString);
});

//判断是否需要回调地址
function editunionschoolCallback(payTypeString) {
    if (payTypeString.substr(0, 1) == "1" || payTypeString.substr(2, 1) == "1"
        || payTypeString.substr(3, 1) == "1") {
        $("#editunionschoolCallbacks").show();
        $("#unionschoolCallback").attr("name", "payCompanyInfos[" + $("#editunionschoolIsCallback").val() + "].unionSchool.callbackAddress");
        $("#unionschoolCallback").attr("required", "");
    } else {
        $("#editunionschoolCallbacks").hide();
        $("#unionschoolCallback").removeAttr("name");
        $("#unionschoolCallback").removeAttr("required");
    }
}

$("#editFuHuiBaType").change(function () {
    var reslist = $("#editFuHuiBaType").select2("data");
    $("#editFuHuiBaTypes").val(payTypes(reslist));
});

$("#editabcbType").change(function () {
    var reslist = $("#editabcbType").select2("data");
    $("#editabcTypes").val(payTypes(reslist));
});

$("#editqsftype").change(function () {
    var reslist = $("#editqsftype").select2("data");
    var payTypeString = payTypes(reslist);
    $("#editqsftypes").val(payTypeString);
});

$("#edithuiYinTongType").change(function () {
    var reslist = $("#edithuiYinTongType").select2("data");
    $("#edithuiYinTongTypes").val(payTypes(reslist));
});


$("#editbocomType").change(function () {
    var reslist = $("#editbocomType").select2("data");
    var payTypeString = payTypes(reslist);
    editbocomCallback(payTypeString);
    $("#editbocomTypes").val(payTypeString);
});

//判断是否需要回调地址
function editbocomCallback(payTypeString) {
    if (payTypeString.substr(0, 1) == "1" || payTypeString.substr(2, 1) == "1"
        || payTypeString.substr(3, 1) == "1") {
        $("#editbocomCallbacks").show();
        $("#editbocomCallback").attr("name", "payCompanyInfos[" + $("#editbocomIsCallback").val() + "].bocom.callbackAddress");
        $("#editbocomCallback").attr("required", "");
    } else {
        $("#editbocomCallbacks").hide();
        $("#editbocomCallback").removeAttr("name");
        $("#editbocomCallback").removeAttr("required");
    }
}

//拉卡拉
$("#editlaKaLaType").change(function () {
    var reslist = $("#editlaKaLaType").select2("data");
    var payTypeString = payTypes(reslist);
    editlaKaLaCallback(payTypeString);
    $("#editlaKaLaTypes").val(payTypeString);
});


//判断是否需要回调地址
function editlaKaLaCallback(payTypeString) {
    if (payTypeString.substr(0, 1) == "1" || payTypeString.substr(2, 1) == "1"
        || payTypeString.substr(3, 1) == "1") {
        $("#editlaKaLaCallbacks").show();
        $("#editlaKaLaCallback").attr("name", "payCompanyInfos[" + $("#editlaKaLaIsCallback").val() + "].laKaLaVo.callbackAddress");
        $("#editlaKaLaCallback").attr("required", "");
    } else {
        $("#editlaKaLaCallbacks").hide();
        $("#editlaKaLaCallback").removeAttr("name");
        $("#editlaKaLaCallback").removeAttr("required");
    }
}

//邮政
$("#editpsbcType").change(function () {
    var reslist = $("#editpsbcType").select2("data");
    $("#editpsbcTypes").val(payTypes(reslist));
});

//扫呗
$("#editsaobeiType").change(function () {
    var reslist = $("#editsaobeiType").select2("data");
    $("#editsaobeiTypes").val(payTypes(reslist));
});
//嗨客
$("#edithaikeType").change(function () {
    var reslist = $("#edithaikeType").select2("data");
    $("#edithaikeTypes").val(payTypes(reslist));
});
//富友
$("#editfuyouType").change(function () {
    var reslist = $("#editfuyouType").select2("data");
    $("#editfuyouTypes").val(payTypes(reslist));
});
//进钱吧
$("#editlongzhimengType").change(function () {
    var reslist = $("#editlongzhimengType").select2("data");
    $("#editlongzhimengTypes").val(payTypes(reslist));
});


//清空支付宝的文本框
function editzhifubaoclear() {
    $("#editappID1").val("");
    $("#editpid").val("");
    $("#editprivateKey").val("");
    $("#editpublicKey").val("");
    $("#editalipayPublicKey").val("");
    $("#editremark1").val("");
}

//清空微信的文本框
function editweixinclear() {
    $("#editappID").val("");
    $("#editmchid").val("");
    $("#editkey").val("");
    $("#editremark").val("");
}

//清空银联支付的文本框
function editunionclear() {
    $("#editmchid1").val("");
    $("#editkey1").val("");
    $("#editremark2").val("");
}


//工行聚合支付
function editicbc(i) {
    $("#editicbcAppId").attr("name", "payCompanyInfos[" + i + "].icbcVo.appId");
    $("#editmerSerId").attr("name", "payCompanyInfos[" + i + "].icbcVo.merSerId");
    $("#editmerSerPrtclNo").attr("name", "payCompanyInfos[" + i + "].icbcVo.merSerPrtclNo");
    //$("#editicbcMchid").attr("name","payCompanyInfos["+i+"].icbcVo.merId");
    $("#editicbcPrivateKey").attr("name", "payCompanyInfos[" + i + "].icbcVo.privateKey");
    $("#editicbcPublicKey").attr("name", "payCompanyInfos[" + i + "].icbcVo.publicKey");
    $("#editicbcPayType").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#editicbcRemark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#editicbcPayTypeselect").attr("data-placeholder", "请从列表选择一项");
    $("#editicbcPayTypeselect").attr("required", "");
    $("#editicbcAppId").attr("required", "");
    $("#editmerSerId").attr("required", "");
    $("#editmerSerPrtclNo").attr("required", "");
    //$("#editicbcMchid").attr("required","");
    $("#editicbcPrivateKey").attr("required", "");
    $("#editicbcPublicKey").attr("required", "");
}

//给z支付宝赋值
function editzhifubao(i) {
    $("#editappID1").attr("name", "payCompanyInfos[" + i + "].zfbPayJsonVo.appID");
    $("#editpid").attr("name", "payCompanyInfos[" + i + "].zfbPayJsonVo.pid");
    $("#editprivateKey").attr("name", "payCompanyInfos[" + i + "].zfbPayJsonVo.privateKey");
    $("#editpublicKey").attr("name", "payCompanyInfos[" + i + "].zfbPayJsonVo.publicKey");
    $("#editalipayPublicKey").attr("name", "payCompanyInfos[" + i + "].zfbPayJsonVo.alipayPublicKey");
    $("#editremark1").attr("name", "payCompanyInfos[" + i + "].remark");
    $("#editpayType2").attr("name", "payCompanyInfos[" + i + "].payType");

    $("#editzpaytype").attr("data-placeholder", "请从列表选择一项");
    $("#editzpaytype").attr("required", "");
    $("#editappID1").attr("required", "");
    $("#editpid").attr("required", "");
    $("#editprivateKey").attr("required", "");
    $("#editpublicKey").attr("required", "");
    $("#editalipayPublicKey").attr("required", "");

    $("#editaliIsCallback").val(i);
}

//给银联支付赋值
function editunion(i) {
    $("#editmchid1").attr("name", "payCompanyInfos[" + i + "].unionJsonPayVo.mchid");
    $("#editkey1").attr("name", "payCompanyInfos[" + i + "].unionJsonPayVo.key");
    $("#editpayType3").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#editremark2").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#editunionpaytype").attr("data-placeholder", "请从列表选择一项");
    $("#editunionpaytype").attr("required", "");
    $("#editmchid1").attr("required", "");
    $("#editkey1").attr("required", "");

    $("#editunionIsCallback").val(i);
}

//青岛农商
function editQDNS(i) {
    $("#editcommid").attr("name", "payCompanyInfos[" + i + "].qingDaoNongShangJsonVo.commid");
    $("#editcommoperid").attr("name", "payCompanyInfos[" + i + "].qingDaoNongShangJsonVo.commoperid");
    $("#editcommstoreno").attr("name", "payCompanyInfos[" + i + "].qingDaoNongShangJsonVo.commstoreno");
    $("#editdevsn").attr("name", "payCompanyInfos[" + i + "].qingDaoNongShangJsonVo.devsn");
    $("#editqingDaoNongShangkey").attr("name", "payCompanyInfos[" + i + "].qingDaoNongShangJsonVo.key");

    $("#editpayType4").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#editremark3").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#editqingDaoNongShangtype").attr("data-placeholder", "请从列表选择一项");
    $("#editqingDaoNongShangtype").attr("required", "");
    $("#editcommid").attr("required", "");
    $("#editcommoperid").attr("required", "");
    $("#editcommstoreno").attr("required", "");
    $("#editdevsn").attr("required", "");
    $("#editqingDaoNongShangkey").attr("required", "");
}

//收钱吧
function editShouQianBa(i) {
    $("#editterminal_sn").attr("name", "payCompanyInfos[" + i + "].shouQianBaVo.terminal_sn");
    $("#editterminal_key").attr("name", "payCompanyInfos[" + i + "].shouQianBaVo.terminal_key");

    $("#editShouQianBaPayTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#editremark4").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#editShouQianBaPayType").attr("data-placeholder", "请从列表选择一项");
    $("#editShouQianBaPayType").attr("required", "");
    $("#editterminal_sn").attr("required", "");
    $("#editterminal_key").attr("required", "");
}

//移领支付
function editkanclouds(i) {
    $("#editmerchantNum").attr("name", "payCompanyInfos[" + i + "].kancloudVo.merchant_num");
    $("#editkancloudKey").attr("name", "payCompanyInfos[" + i + "].kancloudVo.key");

    $("#editkancloudTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#editkancloudRemark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#editkancloudType").attr("data-placeholder", "请从列表选择一项");
    $("#editkancloudType").attr("required", "");
    $("#editmerchantNum").attr("required", "");
    $("#editkancloudKey").attr("required", "");
}

//乐刷
function editleshua(i) {
    $("#editleshuamerchantId").attr("name", "payCompanyInfos[" + i + "].leShua.merchant_id");
    $("#editleshuaKey").attr("name", "payCompanyInfos[" + i + "].leShua.key");

    $("#editleshuaTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#editleshuaRemark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#editleshuaType").attr("data-placeholder", "请从列表选择一项");
    $("#editleshuaType").attr("required", "");
    $("#editleshuamerchantId").attr("required", "");
    $("#editleshuaKey").attr("required", "");
}

//大华捷通
function editchinaums(i) {
    $("#editchinaumsmerchantId").attr("name", "payCompanyInfos[" + i + "].chinaums.merid");
    $("#editchinaumsdevsn").attr("name", "payCompanyInfos[" + i + "].chinaums.devsn");
    $("#editchinaumsKey").attr("name", "payCompanyInfos[" + i + "].chinaums.key");


    $("#editchinaumsTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#editchinaumsRemark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#editchinaumsType").attr("data-placeholder", "请从列表选择一项");
    $("#editchinaumsType").attr("required", "");
    $("#editchinaumsmerchantId").attr("required", "");
    $("#editchinaumsdevsn").attr("required", "");
    $("#editchinaumsKey").attr("required", "");

    $("#editchinaumsIsCallback").val(i);
}

function editccbb(i) {
    $("#editccbbPayTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#editccbbremark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#editccbbPayType").attr("data-placeholder", "请从列表选择一项");


    $("#editccbbChecked").val(i);
}

function editcheckboxOnclick(checkbox) {
    console.log('已经进入程序' + checkbox.checked);
    if (checkbox.checked == true) {
        $("#editMERCHANTID").attr("name", "payCompanyInfos[" + $("#editccbbChecked").val() + "].ccbbVo.MERCHANTID");
        $("#editPOSID").attr("name", "payCompanyInfos[" + $("#editccbbChecked").val() + "].ccbbVo.POSID");
        $("#editBRANCHID").attr("name", "payCompanyInfos[" + $("#editccbbChecked").val() + "].ccbbVo.BRANCHID");
        $("#editccbbPubKey").attr("name", "payCompanyInfos[" + $("#editccbbChecked").val() + "].ccbbVo.publicKey");
        $("#editUSERID").attr("name", "payCompanyInfos[" + $("#editccbbChecked").val() + "].ccbbVo.USERID");
        $("#editccbbPASSWORD").attr("name", "payCompanyInfos[" + $("#editccbbChecked").val() + "].ccbbVo.PASSWORD");
        $("#editport").attr("name", "payCompanyInfos[" + $("#editccbbChecked").val() + "].ccbbVo.port");

        $("#editMERCHANTID").attr("required", "");
        $("#editPOSID").attr("required", "");
        $("#editBRANCHID").attr("required", "");
        $("#editccbbPubKey").attr("required", "");
        $("#editUSERID").attr("required", "");
        $("#editccbbPASSWORD").attr("required", "");
        $("#editport").attr("required", "");
        $("#editaggregation").show();
    } else {
        $("#editMERCHANTID").removeAttr("required");
        $("#editPOSID").removeAttr("required");
        $("#editBRANCHID").removeAttr("required");
        $("#editccbbPubKey").removeAttr("required");
        $("#editUSERID").removeAttr("required");
        $("#editccbbPASSWORD").removeAttr("required");
        $("#editport").removeAttr("required");

        $("#editMERCHANTID").removeAttr("name");
        $("#editPOSID").removeAttr("name");
        $("#editBRANCHID").removeAttr("name");
        $("#editccbbPubKey").removeAttr("name");
        $("#editUSERID").removeAttr("name");
        $("#editccbbPASSWORD").removeAttr("name");
        $("#editport").removeAttr("name");
        $("#editaggregation").hide();
    }
}

function editcheckboxTwoclick(checkbox) {
    if (checkbox.checked == true) {
        $("#editDCMERCHANTID").attr("name", "payCompanyInfos[" + $("#editccbbChecked").val() + "].ccbbVo.DCMERCHANTID");
        $("#editDCPOSID").attr("name", "payCompanyInfos[" + $("#editccbbChecked").val() + "].ccbbVo.DCPOSID");
        $("#editDCBRANCHID").attr("name", "payCompanyInfos[" + $("#editccbbChecked").val() + "].ccbbVo.DCBRANCHID");
        $("#editccbbDCPubKey").attr("name", "payCompanyInfos[" + $("#editccbbChecked").val() + "].ccbbVo.DCpublicKey");
        $("#editDCpubKey1").attr("name", "payCompanyInfos[" + $("#editccbbChecked").val() + "].ccbbVo.DCpubKey1");
        $("#editDCpriKey1").attr("name", "payCompanyInfos[" + $("#editccbbChecked").val() + "].ccbbVo.DCpriKey1");
        $("#editDCpubKey2").attr("name", "payCompanyInfos[" + $("#editccbbChecked").val() + "].ccbbVo.DCpubKey2");
        $("#editDCFTCORPID").attr("name", "payCompanyInfos[" + $("#editccbbChecked").val() + "].ccbbVo.DCFTCORPID");
        $("#editDCUSERID").attr("name", "payCompanyInfos[" + $("#editccbbChecked").val() + "].ccbbVo.DCUSERID");
        $("#editDCPASSWORD").attr("name", "payCompanyInfos[" + $("#editccbbChecked").val() + "].ccbbVo.DCPASSWORD");

        $("#editDCMERCHANTID").attr("required", "");
        $("#editDCPOSID").attr("required", "");
        $("#editDCBRANCHID").attr("required", "");
        $("#editccbbDCPubKey").attr("required", "");
        $("#editDCpubKey1").attr("required", "");
        $("#editDCpriKey1").attr("required", "");
        $("#editDCpubKey2").attr("required", "");
        $("#editDCFTCORPID").attr("required", "");
        $("#editDCUSERID").attr("required", "");
        $("#editDCPASSWORD").attr("required", "");
        $("#editDC").show();
    } else {
        $("#editDCMERCHANTID").removeAttr("required");
        $("#editDCPOSID").removeAttr("required");
        $("#editDCBRANCHID").removeAttr("required");
        $("#editccbbDCPubKey").removeAttr("required");
        $("#editDCpubKey1").removeAttr("required");
        $("#editDCpriKey1").removeAttr("required");
        $("#editDCpubKey2").removeAttr("required");
        $("#editDCFTCORPID").removeAttr("required");
        $("#editDCUSERID").removeAttr("required");
        $("#editDCPASSWORD").removeAttr("required");

        $("#editDCMERCHANTID").removeAttr("name");
        $("#editDCPOSID").removeAttr("name");
        $("#editDCBRANCHID").removeAttr("name");
        $("#editccbbDCPubKey").removeAttr("name");
        $("#editDCpubKey1").removeAttr("name");
        $("#editDCpubKey1").removeAttr("name");
        $("#editDCpubKey2").removeAttr("name");
        $("#editDCFTCORPID").removeAttr("name");
        $("#editDCUSERID").removeAttr("name");
        $("#editDCPASSWORD").removeAttr("name");
        $("#editDC").hide();
    }
}

function editcheckboxThreeclick(checkbox) {
    if (checkbox.checked == true) {
        $("#editappidUNIONPAYPS").attr("name", "payCompanyInfos[" + $("#editccbbChecked").val() + "].ccbbVo.appId");
        $("#editappkeyUNIONPAYPS").attr("name", "payCompanyInfos[" + $("#editccbbChecked").val() + "].ccbbVo.appKey");
        $("#editmerchantCodeUNIONPAYPS").attr("name", "payCompanyInfos[" + $("#editccbbChecked").val() + "].ccbbVo.merchantCode");
        $("#editterminalCodeUNIONPAYPS").attr("name", "payCompanyInfos[" + $("#editccbbChecked").val() + "].ccbbVo.terminalCode");

        $("#editappidUNIONPAYPS").attr("required", "");
        $("#editappkeyUNIONPAYPS").attr("required", "");
        $("#editmerchantCodeUNIONPAYPS").attr("required", "");
        $("#editterminalCodeUNIONPAYPS").attr("required", "");
        $("#editUNIONPAYPS").show();
    } else {
        $("#editappidUNIONPAYPS").removeAttr("required");
        $("#editappkeyUNIONPAYPS").removeAttr("required");
        $("#editmerchantCodeUNIONPAYPS").removeAttr("required");
        $("#editterminalCodeUNIONPAYPS").removeAttr("required");

        $("#editappidUNIONPAYPS").removeAttr("name");
        $("#editappkeyUNIONPAYPS").removeAttr("name");
        $("#editmerchantCodeUNIONPAYPS").removeAttr("name");
        $("#editterminalCodeUNIONPAYPS").removeAttr("name");
        $("#editUNIONPAYPS").hide();
    }
}

function editcheckboxFourclick(checkbox) {
    if (checkbox.checked == true) {

        if (checkbox.checked == true) {
            $("#editmchIdSCANPAY").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.scan_mchtNo");
            $("#edittermNoSCANPAY").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.scan_termNo");
            $("#editposIdSCANPAY").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.scan_posId");
            $("#editkeySCANPAY").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.scan_key");
            $("#editauthcodeSCANPAY").attr("name", "payCompanyInfos[" + $("#ccbbChecked").val() + "].ccbbVo.scan_authCode");


            $("#editmchIdSCANPAY").attr("required", "");
            $("#edittermNoSCANPAY").attr("required", "");
            $("#editposIdSCANPAY").attr("required", "");
            $("#editkeySCANPAY").attr("required", "");
            $("#editauthcodeSCANPAY").attr("required", "");
            $("#editSCANPAY").show();
        } else {
            $("#editmchIdSCANPAY").removeAttr("required");
            $("#edittermNoSCANPAY").removeAttr("required");
            $("#editposIdSCANPAY").removeAttr("required");
            $("#editkeySCANPAY").removeAttr("required");
            $("#editauthcodeSCANPAY").removeAttr("required", "");

            $("#editmchIdSCANPAY").removeAttr("name");
            $("#edittermNoSCANPAY").removeAttr("name");
            $("#editposIdSCANPAY").removeAttr("name");
            $("#editkeySCANPAY").removeAttr("name");
            $("#editauthcodeSCANPAY").removeAttr("name");
            $("#editSCANPAY").hide();
        }
    }

}
//银联校园版
function editunionschool(i) {
    $("#editunionschoolBrandId").attr("name", "payCompanyInfos[" + i + "].unionSchool.brand_id");
    $("#editunionschoolOpshopId").attr("name", "payCompanyInfos[" + i + "].unionSchool.op_shop_id");
    $("#editunionschoolBussType").attr("name", "payCompanyInfos[" + i + "].unionSchool.buss_type");
    $("#editunionschoolKey").attr("name", "payCompanyInfos[" + i + "].unionSchool.key");


    $("#editunionschoolTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#editunionschoolRemark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#editunionschoolType").attr("data-placeholder", "请从列表选择一项");
    $("#editunionschoolType").attr("required", "");
    $("#editunionschoolBrandId").attr("required", "");
    $("#editunionschoolOpshopId").attr("required", "");
    $("#editunionschoolBussType").attr("required", "");
    $("#editunionschoolKey").attr("required", "");

    $("#editunionschoolIsCallback").val(i);
}

//付惠吧
function editFuHuiBa(i) {
    $("#editFuHuiBaKey").attr("name", "payCompanyInfos[" + i + "].fuHuiBaVo.key");


    $("#editFuHuiBaTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#editFuHuiBaRemark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#editFuHuiBaType").attr("data-placeholder", "请从列表选择一项");
    $("#editFuHuiBaType").attr("required", "");
    $("#editFuHuiBaKey").attr("required", "");
}

//农行
function editabc(i) {
    $("#editabcmerchantID").attr("name", "payCompanyInfos[" + i + "].abc.merchantID");
    $("#editabcmerchantPrivateKey").attr("name", "payCompanyInfos[" + i + "].abc.merchantPrivateKey");
    $("#editreceiveAccount").attr("name", "payCompanyInfos[" + i + "].abc.receiveAccount");
    $("#editterminalNo").attr("name", "payCompanyInfos[" + i + "].abc.terminalNo");

    $("#editabcTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#editabcRemark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#editabcbType").attr("data-placeholder", "请从列表选择一项");
    $("#editabcbType").attr("required", "");
    $("#editabcmerchantID").attr("required", "");
    $("#editabcmerchantPrivateKey").attr("required", "");
    $("#editterminalNo").attr("required", "");
}

//轻松付
function editqingsongfu(i) {
    $("#editqsfappID").attr("name", "payCompanyInfos[" + i + "].qsf.appid");
    $("#editqsfmchid").attr("name", "payCompanyInfos[" + i + "].qsf.mchid");
    $("#editqsfmchSerialNo").attr("name", "payCompanyInfos[" + i + "].qsf.mchSerialNo");
    $("#editqsfcertificate").attr("name", "payCompanyInfos[" + i + "].qsf.certificate");
    $("#editwechatpaySerial").attr("name", "payCompanyInfos[" + i + "].qsf.wechatpaySerial");
    $("#editapiV3Key").attr("name", "payCompanyInfos[" + i + "].qsf.apiV3Key");
    $("#editwxChannel").attr("name", "payCompanyInfos[" + i + "].qsf.wx_channel");
    $("#editqsfprivateKey").attr("name", "payCompanyInfos[" + i + "].qsf.privateKey");
    $("#editqsfSchoolId").attr("name", "payCompanyInfos[" + i + "].qsf.schoolId");
    $("#editqsfOrganizationId").attr("name", "payCompanyInfos[" + i + "].qsf.organizationId");
    $("#editqsfkey").attr("name", "payCompanyInfos[" + i + "].qsf.key");
    $("#editremark").attr("name", "payCompanyInfos[" + i + "].remark");
    $("#editqsftypes").attr("name", "payCompanyInfos[" + i + "].payType");

    $("#editqsftype").attr("data-placeholder", "请从列表选择一项");
    $("#editqsftype").attr("required", "");
    $("#editqsfappID").attr("required", "");
    $("#editqsfmchid").attr("required", "");
    $("#editqsfmchSerialNo").attr("required", "");
    $("#editqsfcertificate").attr("required", "");
    $("#editwechatpaySerial").attr("required", "");
    $("#editapiV3Key").attr("required", "");
    $("#editwxChannel").attr("required", "");
    $("#editqsfprivateKey").attr("required", "");

    //判断是否需要子商户
    $("#editqsfIsCallback").val(i);
    var val = $('input:radio[name="qsfIsEvery"]:checked').val();
    if (val == "1") {
        editqsfIsZiShangHu();
    }
}

function editqsfIsZiShangHu() {
    //显示微信的字商户 WXChildAppID
    $("#editqsfZiAppID").show();
    $("#editqsfChildAppID").attr("name", "payCompanyInfos[" + $("#editqsfIsCallback").val() + "].qsf.sub_appid");
    $("#editqsfChildAppID").attr("required", "");

    $("#editqsfsubMchids").show();
    $("#editqsfSubMchid").attr("name", "payCompanyInfos[" + $("#editqsfIsCallback").val() + "].qsf.sub_mchid");
    $("#editqsfSubMchid").attr("required", "");
}

//是不需要子商户，隐藏子商户
function editqsfIsbuZiShangHu() {
    //隐藏微信的字商户
    $("#editqsfZiAppID").hide();
    $("#editqsfChildAppID").removeAttr("name");
    $("#editqsfChildAppID").removeAttr("required");

    $("#editqsfsubMchids").hide();
    $("#editqsfSubMchid").removeAttr("name");
    $("#editqsfSubMchid").removeAttr("required");
}

//汇银通POS
function editHuiYinTong(i) {
    $("#editInstNo").attr("name", "payCompanyInfos[" + i + "].huiYinTong.instNo");
    $("#editMerchId").attr("name", "payCompanyInfos[" + i + "].huiYinTong.merchId");
    $("#editTermId").attr("name", "payCompanyInfos[" + i + "].huiYinTong.termId");
    $("#edithuiYinTongKey").attr("name", "payCompanyInfos[" + i + "].huiYinTong.key");


    $("#edithuiYinTongTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#edithuiYinTongremark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#edithuiYinTongType").attr("data-placeholder", "请从列表选择一项");
    $("#edithuiYinTongType").attr("required", "");
    $("#editInstNo").attr("required", "");
    $("#editMerchId").attr("required", "");
    $("#editTermId").attr("required", "");
    $("#edithuiYinTongKey").attr("required", "");
}


//给交行赋值
function editbocom(i) {
    $("#editbocomMerPtcId").attr("name", "payCompanyInfos[" + i + "].bocom.merPtcId");
    $("#editbocomAppID").attr("name", "payCompanyInfos[" + i + "].bocom.appID");
    $("#editmyPrivateKey").attr("name", "payCompanyInfos[" + i + "].bocom.myPrivateKey");
    $("#editapigwPublicKey").attr("name", "payCompanyInfos[" + i + "].bocom.apigwPublicKey");
    $("#editbocomTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#editbocomRemark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#editbocomType").attr("data-placeholder", "请从列表选择一项");
    $("#editbocomType").attr("required", "");
    $("#editbocomMerPtcId").attr("required", "");
    $("#editbocomAppID").attr("required", "");
    $("#editmyPrivateKey").attr("required", "");
    $("#editapigwPublicKey").attr("required", "");

    $("#editbocomIsCallback").val(i);
}

//给拉卡拉赋值
function editlaKaLa(i) {
    $("#editlaKaLaAppid").attr("name", "payCompanyInfos[" + i + "].laKaLaVo.appid");
    $("#editlaKaLaMchSerialNo").attr("name", "payCompanyInfos[" + i + "].laKaLaVo.mchSerialNo");
    $("#editlaKaLaMerchantNo").attr("name", "payCompanyInfos[" + i + "].laKaLaVo.merchantNo");
    $("#editlaKaLaTermNo").attr("name", "payCompanyInfos[" + i + "].laKaLaVo.termNo");
    $("#editlaKaLaTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#editlaKaLaRemark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#editlaKaLaType").attr("data-placeholder", "请从列表选择一项");
    $("#editlaKaLaType").attr("required", "");
    $("#editlaKaLaAppid").attr("required", "");
    $("#editlaKaLaMchSerialNo").attr("required", "");
    $("#editlaKaLaMerchantNo").attr("required", "");
    $("#editlaKaLaTermNo").attr("required", "");

    $("#editlaKaLaIsCallback").val(i);
}

//邮政
function editpsbc(i) {
    $("#editpsbcMercId").attr("name", "payCompanyInfos[" + i + "].psbc.mercId");
    $("#editpsbcTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#editpsbcRemark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#editpsbcType").attr("data-placeholder", "请从列表选择一项");
    $("#editpsbcType").attr("required", "");
    $("#editpsbcMercId").attr("required", "");
}

//扫呗
function editsaobei(i) {
    $("#editsaobeiMerchantNo").attr("name", "payCompanyInfos[" + i + "].saoBei.merchantNo");
    $("#editsaobeiTerminalId").attr("name", "payCompanyInfos[" + i + "].saoBei.terminalId");
    $("#editsaobeiTokenKey").attr("name", "payCompanyInfos[" + i + "].saoBei.tokenKey");
    $("#editsaobeiTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#editsaobeiRemark").attr("name", "payCompanyInfos[" + i + "].remark");


    $("#editsaobeiType").attr("data-placeholder", "请从列表选择一项");
    $("#editsaobeiType").attr("required", "");
    $("#editsaobeiMerchantNo").attr("required", "");
    $("#editsaobeiTokenKey").attr("required", "");
    $("#editsaobeiTerminalId").attr("required", "");
}

//嗨客
function edithaike(i) {
    $("#edithaikemerchantNum").attr("name", "payCompanyInfos[" + i + "].haiKeVo.merchantNum");
    $("#edithaikeappid").attr("name", "payCompanyInfos[" + i + "].haiKeVo.appid");
    $("#edithaikestoreNum").attr("name", "payCompanyInfos[" + i + "].haiKeVo.storeNum");
    $("#edithaikestaffNum").attr("name", "payCompanyInfos[" + i + "].haiKeVo.staffNum");
    $("#edithaikekey").attr("name", "payCompanyInfos[" + i + "].haiKeVo.key");
    $("#edithaikeTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#edithaikeRemark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#edithaikeType").attr("data-placeholder", "请从列表选择一项");
    $("#edithaikeType").attr("required", "");
    $("#edithaikemerchantNum").attr("required", "");
    $("#edithaikeappid").attr("required", "");
    $("#edithaikestoreNum").attr("required", "");
    $("#edithaikestaffNum").attr("required", "");
    $("#edithaikekey").attr("required", "");
}

//富友
function editfuyou(i) {
    $("#editfuyoumchntCd").attr("name", "payCompanyInfos[" + i + "].fuYouVo.mchntCd");
    $("#editfuyouTypes").attr("name", "payCompanyInfos[" + i + "].payType");
    $("#editfuyouRemark").attr("name", "payCompanyInfos[" + i + "].remark");

    $("#editfuyouType").attr("data-placeholder", "请从列表选择一项");
    $("#editfuyouType").attr("required", "");
    $("#editfuyoumchntCd").attr("required", "");
}

//进钱吧
function editlongzhimeng(i) {
    $("#editlongzhimengmchId").attr("name", "payCompanyInfos[" + i + "].longZhiMengVo.mchId");
    $("#editlongzhimengappid").attr("name", "payCompanyInfos[" + i + "].longZhiMengVo.appid");
    $("#editlongzhimengmd5").attr("name", "payCompanyInfos[" + i + "].longZhiMengVo.md5");

    $("#editlongzhimengTypes").attr("name", "payCompanyInfos[" + i + "].payType");


    $("#editlongzhimengType").attr("data-placeholder", "请从列表选择一项");
    $("#editlongzhimengType").attr("required", "");

    $("#editlongzhimengmchId").attr("required", "");
    $("#editlongzhimengappid").attr("required", "");
    $("#editlongzhimengmd5").attr("required", "");
}

